package com.ruicar.afs.cloud.basic.proceeds.pay.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ruicar.afs.cloud.basic.common.entity.BasicChannelInfo;
import com.ruicar.afs.cloud.basic.common.entity.BasicMainInfo;
import com.ruicar.afs.cloud.basic.proceeds.pay.condition.PayListQueryCondition;
import com.ruicar.afs.cloud.basic.proceeds.pay.entity.BasicPaymentBank;
import com.ruicar.afs.cloud.basic.proceeds.pay.entity.BasicPaymentPool;
import com.ruicar.afs.cloud.common.core.util.IResponse;
import com.ruicar.afs.cloud.common.modules.contract.enums.YesOrNoEnum;
import com.ruicar.afs.cloud.easypass.process.dto.PayResultQryDTO;

import java.util.List;

/**
 * @author: Lee
 * @date 2020-05-30 04:34:35 
 * @description
 */
public interface BasicPaymentPoolService extends IService<BasicPaymentPool> {

	/**
	 * 获取付款中状态的msgid
	 * @author ZC.GUO
	 * @param
	 * @return
	 */
	List<String> queryMsgIdList();
	/**
	 * 查询放款数据
	 * @param payListQueryCondition
	 * @return
	 */
	IResponse queryPayMentByQueryParam(PayListQueryCondition payListQueryCondition);
	/**
	 * 查询放款数据
	 * @param payListQueryCondition
	 * @return
	 */
	IResponse exportPayList(PayListQueryCondition payListQueryCondition);

	/**
	 * 手工发送付款数据
	 * @param pool
	 * @return
	 */
	void sendPaymentPool(BasicPaymentPool pool, String chlCd, BasicPaymentBank payAccount);

	/**
	 * 查询付款结果
	 * @author ZC.GUO
	 * @param msgid 付款请求msgid
	 * @return
	 */
	public void queryPayResult(String msgid);

	/**
	 * 付款结果处理
	 * @author ZC.GUO
	 * @param paymentPool 付款池记录
	 * @param resultDetail 付款结果封装
	 * @return
	 */
	public void handlePayResult(BasicPaymentPool paymentPool,PayResultQryDTO.PayResultQryListDTO resultDetail);
	/**
	 * 付款结果处理
	 * @author ZC.GUO
	 * @param payResultQryDTO 付款结果封装
	 * @return
	 */
	public void handlePayResult(PayResultQryDTO payResultQryDTO,String msgid);

	/**
	 * 付款成功处理
	 * @author ZC.GUO
	 * @param paymentPool 付款池记录
	 * @return
	 */
	public void paySuccess(BasicPaymentPool paymentPool, String msg);
	/**
	 * 付款成功发送短信
	 * @author ZC.GUO
	 * @param paymentPool 付款池记录
	 * @return
	 */
	public void sendPaySuccessMsg(BasicPaymentPool paymentPool, BasicMainInfo mainInfo);

	/**
	 * 付款失败处理
	 * @author ZC.GUO
	 * @param paymentPool 付款池记录
	 * @param msg 反馈信息
	 * @return
	 */
	public void payFail(BasicPaymentPool paymentPool,String msg);
	/**
	 * 正在付款中处理
	 * @author ZC.GUO
	 * @param paymentPool 付款池记录
	 * @param msg 反馈信息
	 * @return
	 */
	public void paying(BasicPaymentPool paymentPool,String msg);

	/**
	 * 发送扣款指令
	 * @author ZC.GUO
	 * @param paymentPool
	 * @return
	 */
	public void sendPayOrder(BasicPaymentPool paymentPool,String chlCd);

	/**
	 * 自动付款
	 * @author ZC.GUO
	 * @return
	 */
	public void autoPay(List<BasicPaymentPool> poolList, String chlCd,BasicPaymentBank bankAccount);


	/**
	 * 开始进行付款操作时锁定数据
	 * @author ZC.GUO
	 * @param basicPaymentPool 付款池数据
	 * @return
	 */
	public boolean lockWhenStartPay(BasicPaymentPool basicPaymentPool);
	/**
	 * 单笔数据锁定
	 * @author ZC.GUO
	 * @param basicPaymentPool 付款池数据
	 * @return
	 */
	public boolean readySingleWhenStartPay(BasicPaymentPool basicPaymentPool);
	/**
	 * 多笔数据锁定
	 * @author ZC.GUO
	 * @param idList 付款池数据
	 * @return
	 */
	public boolean readyBatchWhenStartPay(List<Long> idList);
	/**
	 * 多笔数据解锁
	 * @author ZC.GUO
	 * @param idList 付款池数据
	 * @param action 锁定或解锁
	 * @return
	 */
	public boolean updatePaymentPoolStatus(YesOrNoEnum action,List<Long> idList);
	/**
	 * 查询渠道最新的收款账号并进行更新
	 * @author ZC.GUO
	 * @param paymentPool 付款池数据
	 * @return
	 */
	public void queryAndChangeAccountInfo(BasicPaymentPool paymentPool);
	/**
	 * 发送账号错误的消息并更新
	 * @author ZC.GUO
	 * @param paymentPool 付款池数据
	 * @return
	 */
	public void sendMsgAndUpdatePool(BasicPaymentPool paymentPool);


	/**
	 * 解决放款异常
	 * @author ZC.GUO
	 * @param idList idList
	 * @return
	 */
	public void handleExceptionForPayment(List<Long> idList);


	/**
	 * 修改付款池数据收款账号
	 * @author ZC.GUO
	 * @param channelInfo 合同渠道信息
	 * @param paymentPool 付款池数据
	 * @return
	 */
	public void changeReceiptAccountInfo(BasicChannelInfo channelInfo,BasicPaymentPool paymentPool);


}
